Function: ht<-alist

ht<-alist is a byte-compiled function defined in ht.el.

Signature

(ht<-alist ALIST &optional TEST)

Documentation

Create a hash table with initial values according to ALIST.

TEST indicates the function used to compare the hash keys. Default is equal. It can be eq, eql, equal or a user-supplied test created via define-hash-table-test.

Aliases

ht-from-alist

Source Code

;; Defined in ~/.emacs.d/elpa/ht-20230703.558/ht.el
(defun ht<-alist (alist &optional test)
  "Create a hash table with initial values according to ALIST.

TEST indicates the function used to compare the hash
keys.  Default is `equal'.  It can be `eq', `eql', `equal' or a
user-supplied test created via `define-hash-table-test'."
  (declare (side-effect-free t))
  (let ((h (ht-create test)))
    ;; the first key-value pair in an alist gets precedence, so we
    ;; start from the end of the list:
    (dolist (pair (reverse alist) h)
      (let ((key (car pair))
            (value (cdr pair)))
        (ht-set! h key value)))))